package com.ljyh.cygnus.model

import com.topjohnwu.superuser.Shell

sealed class CommandUiState {
    object Idle : CommandUiState()
    object Loading : CommandUiState()
    data class Success(val output: CommandOutput) : CommandUiState()
    data class Error(val message: String, val output: CommandOutput?) : CommandUiState()
}

data class CommandOutput(
    val result: Shell.Result,
    val stdout: List<String>,
    val stderr: List<String>
) {
    val isSuccess: Boolean get() = result.isSuccess
    val code: Int get() = result.code
}

